import { Entity, Columns, ColumnType, Id, NotNull } from "@ohos/dataorm"
import { TableBasic } from "./TableBasic";

@Entity('users',[{ value: 'name', unique: true }])
export class User  extends TableBasic{

  @Id()
  @Columns({ columnName: 'id', types: ColumnType.num })
  id: number;

  @NotNull()
  @Columns({ columnName: 'name', types: ColumnType.str })
  name: string;

  constructor(id?: number, name?: string) {
    super(1733384772);
    this.id = id;
    this.name = name;
  }

  getId(): number {
    return this.id;
  }

  setId(id: number) {
    this.id = id;
  }

  getName(): string {
    return this.name;
  }

  setName(name: string) {
    this.name = name;
  }
}